import request from '@/utils/request';

/***
 * 地震速报
 */
export const getEarthquakeQuickReport = (params: any) => {
  return request({
    url: '/earthquakeQuickReport/list',
    method: 'get',
    params,
  });
};

/**
 * 气象预报
 */
export const getWeatherWarning = (params: any) => {
  return request({
    url: '/weatherWarning/list',
    method: 'get',
    params,
  });
};

/**
 *节假日信息
 */
export const getcalendarList = (params: any) => {
  return request({
    url: '/calendar/list',
    method: 'get',
    params,
  });
};

/*************************************避难所信息********************************/
/**
 * 查询列表
 */
export const listCertificate = (data: any) => {
  const { pageNum, pageSize, ..._data } = data;
  return request({
    url: '/refuge/list' + `?pageNum=${pageNum}&pageSize=${pageSize}`,
    method: 'post',
    data: _data,
  });
};

/**
 * 新增
 */
export const addShelter = (data: any) => {
  return request({
    url: '/refuge',
    method: 'post',
    data: data,
  });
};

/**
 * 修改
 */
export const updateShelter = (data: any) => {
  return request({
    url: '/refuge',
    method: 'put',
    data: data,
  });
};
/**
 * 删除
 */
export const delShelter = (menuId: any) => {
  return request({
    url: '/refuge/' + menuId,
    method: 'delete',
  });
};

/**
 * 获取省市区JSON
 */
export const getAreaJson = () => {
  return request({
    url: '/chinaArea/areaMap',
    method: 'get',
  });
};

/**
 * 根据坐标返回地址
 */
export function getAddress(lon: any, lat: any) {
  return request({
    url: `/device/getAddress/${lon}/${lat}`,
    method: 'get',
  });
}
